home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1996 November
/
Chip 11-96.iso
/
workshop
/
howto
/
mail
< prev
next >
Wrap
Text File
|
1996-05-25
|
25KB
|
656 lines
The Linux Electronic Mail HOWTO
Vince Skahan, <vince@victrola.wa.com>
v1.16, 6 Aug 1994
This document describes the setup and care+feeding of Electronic Mail
(e-mail) under Linux. You need to read this if you plan to communi-
cate locally or to remote sites via electronic mail. You probably do
*not* need to read this document if don't exchange electronic mail
with other users on your system or with other sites.
1. Introduction
The intent of this document is to answer some of the questions and
comments that appear to meet the definition of 'frequently asked
questions' about e-mail software under Linux.
This document and the corresponding UUCP and News 'HOWTO' documents
collectively supersede the UUCP-NEWS-MAIL-FAQ that has previously been
posted to comp.os.linux.announce.
1.1. New versions of this document
New versions of this document will be periodically posted to
comp.os.linux.announce, comp.answers, and news.answers. They will
also be added to the various anonymous ftp sites who archive such
information including sunsite.unc.edu:/pub/Linux/docs/HOWTO.
1.2. Feedback
I am interested in any feedback, positive or negative, regarding the
content of this document via e-mail. Definitely contact me if you
find errors or obvious omissions.
I read, but do not necessarily respond to, all e-mail I receive.
Requests for enhancements will be considered and acted upon based on
that day's combination of available time, merit of the request, and
daily blood pressure :-)
Flames will quietly go to /dev/null so don't bother.
Feedback concerning the actual format of the document should go to the
HOWTO coordinator - Matt Welsh (mdw@sunsite.unc.edu).
1.3. Copyright Information
The Mail-HOWTO is copyrighted (c)1994 Vince Skahan.
A verbatim copy may be reproduced or distributed in any medium
physical or electronic without permission of the author. Translations
are similarly permitted without express permission if it includes a
notice on who translated it.
Short quotes may be used without prior consent by the author.
Derivative work and partial distributions of the Mail-HOWTO must be
accompanied with either a verbatim copy of this file or a pointer to
the verbatim copy.
Commercial redistribution is allowed and encouraged; however, the
author would like to be notified of any such distributions.
In short, we wish to promote dissemination of this information through
as many channels as possible. However, we do wish to retain copyright
on the HOWTO documents, and would like to be notified of any plans to
redistribute the HOWTOs.
We further want that ALL information provided in the HOWTOS is
disseminated. If you have questions, please contact Matt Welsh, the
Linux HOWTO coordinator, at mdw@sunsite.unc.edu, or +1 607 256 7372.
1.4. Standard Disclaimer
Of course, I disavow any potential liability for the contents of this
document. Use of the concepts, examples, and/or other content of this
document is entirely at your own risk.
1.5. Other sources of information
1.5.1. LINUX HOWTO Documents:
There is plenty of exceptional material provided in the other Linux
HOWTO documents and from the Linux DOC project. In particular, you
might want to take a look at the following:
o the Serial Communications HOWTO
o the Ethernet HOWTO
o the Linux Networking Administration Guide
1.5.2. USENET:
comp.mail.elm the ELM mail system.
comp.mail.mh The Rand Message Handling system.
comp.mail.mime Multipurpose Internet Mail Extensions.
comp.mail.misc General discussions about computer mail.
comp.mail.multi-media Multimedia Mail.
comp.mail.mush The Mail User's Shell (MUSH).
comp.mail.sendmail the BSD sendmail agent.
comp.mail.smail the smail mail agent.
comp.mail.uucp Mail in the uucp environment.
1.5.3. Books
The following is a non-inclusive set of books that will help...
o "Managing UUCP and USENET" from O'Reilly and Associates is in my
opinion the best book out there for figuring out the programs and
protocols involved in being a USENET site.
o "Unix Communications" from The Waite Group contains a nice
description of all the pieces (and more) and how they fit together.
o "Sendmail" from O'Reilly and Associates looks to like the
definitive reference on sendmail-v8 and sendmail+IDA. It's a "must
have" for anybody hoping to make sense out of sendmail without
bleeding in the process.
o "The Internet Complete Reference" from Osborne is a fine reference
book that explains the various services available on Internet and
is a great "one-stop-shopping" source for information on news,
mail, and various other Internet resources.
1.6. Where *NOT* to look for help
There is nothing "special" about configuring and running mail under
Linux (any more). Accordingly, you almost certainly do *NOT* want to
be posting generic mail-related questions to the comp.os.linux.*
newsgroups.
Unless your posting is truly Linux-specific (ie, "please tell me what
routers are already compiled into the SLS1.03 version of smail3.1.28")
you should be asking your questions in one of the newsgroups or
mailing lists referenced above.
Let me repeat that.
There is virtually no reason to post anything mail-related in the
comp.os.linux hierarchy any more. There are existing newsgroups in
the comp.mail.* hierarchy to handle *ALL* your questions.
IF YOU POST TO COMP.OS.LINUX.* FOR NON-LINUX-SPECIFIC QUESTIONS, YOU
ARE LOOKING IN THE WRONG PLACE FOR HELP. THE ELECTRONIC MAIL EXPERTS
HANG OUT IN THE PLACES INDICATED ABOVE AND GENERALLY DO NOT RUN LINUX.
POSTING TO THE LINUX HIERARCHY FOR NON-LINUX-SPECIFIC QUESTIONS WASTES
YOUR TIME AND EVERYBODY ELSE'S...AND IT FREQUENTLY DELAYS YOU FROM
GETTING THE ANSWER TO YOUR QUESTION.
2. Hardware Requirements
There are no specific hardware requirements for mail under Linux.
You'll need some sort of 'transport' software to connect to remote
systems, which means either tcp-ip or uucp. This could mean that you
need a modem or ethernet card (depending on your setup).
3. Getting the software
In general, I grab my sources from ftp.uu.net and the other fine
archive sites on Internet. In addition, Linux-specific binary ports
are found in the usual Linux distrbutions and on the usual Linux
anonymous ftp sites (sunsite.unc.edu and tsx-11.mit.edu in
particular).
The newspak-2.2.tar.z distribution contains config files and readme
files related to building uucp, news, and mail software under Linux
from the various freely-available sources. It can usually be found in
sunsite.unc.edu:/pub/Linux/system/Mail.
4. Mail 'Transport Agents'
This section contains information related to 'transport agents', which
means the underlying software that connects your local system to
remote systems.
4.1. Smail v3.1
Smail3.1 seems to be a de-facto standard transport agent for uucp-only
sites and for some smtp sites. It compiles without patching from the
sources. In addition, smail is provided in binary form in the SLS
distribution of Linux.
The newspak distribution contains config files for smail3.1.28 under
Linux that you can use to start with.
If you're building smail from sources, you need to have the following
in your os/linux file so that 'sed' gives you shell scripts that work
properly.
CASE_NO_NEWLINES=true
For a uucp-only system that has a MX-record and that wants a
domainized header (who goes through a smart-host for everything),
these are the entire config files you'll need:
o replace 'subdomain.domain' with your domain name
o replace 'myhostname' with you un-domainized hostname
o replace 'my_uucp_neighbor' with the uucp name of your upstream site
#-------- /usr/local/lib/smail/config -----------------
#
# domains we belong to
visible_domain=subdomain.domain:uucp
#
# who we're known as (fully-qualified-site-name)
visible_name=myhostname.subdomain.domain
#
# who we go through
smart_path=my_uucp_neighbor
#
#---------- /usr/local/lib/smail/paths --------------
#
# we're a domainized site, make sure we accept mail to both names
myhostname %s
myhostname.subdomain.domain %s
#
#-------------------------------------------------------------------
To run smail as a smtp daemon, add the following to /etc/inetd.conf:
smtp stream tcp nowait root /usr/bin/smtpd smtpd
Outgoing mail gets sent automatically, when using elm. If your inter-
net link is down when you send mail, then the mail sits in
"/usr/spool/smail/input". When the link next comes up, "runq" is run
which causes the mail to be sent.
4.2. Sendmail+IDA
I run a uucp-only site and use sendmail5.65b+IDA1.5 instead of
smail3.1.28 due to the incredible ease of use. There is a binary
distribution in sunsite.unc.edu:pub/Linux/system/Mail. To install it:
o you'll probably want to remove (or rename) all the files from smail
(see the /install/installed directory if you are SLS) to be safe.
o cd to / then "gunzip -c sendmail5.65b+IDA1.5.tpz | tar xvf -" If
you have a "modern" tar from a recent Slackware (for example) you
can probably just do a "tar -zxvf filename.tgz" and get the same
results.
o cd to /usr/local/lib/mail/CF and copy the sample.m4 local.m4 file
to "yourhostname.m4". Edit out the distributed hostname, aliases,
and smarthost and put in the correct one for your site. The
default file is for a uucp-only site who has domainized headers and
who talks to a smart host. Then "make yourhostname.cf" and move
the resulting file to /etc/sendmail.cf
o if you are uucp-only, you do *NOT* need to create any of the tables
mentioned in the README.linux file. You'll just have to touch the
files so that the Makefile works. Just edit the .m4 file, make
sendmail.cf, and start testing it.
o if you're uucp-only and you talk to sites in addition to your
"smart-host", you'll need to add uucpxtable entries for each (or
mail to them will also go through the smart host) and run dbm
against the revised uucpxtable.
o if you use my sendmail5.67b+IDA1.5 distribution you should not use
a "freeze file".
o If you run Rich Braun's original binary distribution of 5.67a,
you'll need to freeze the configuration if you change your .cf file
with "/usr/lib/sendmail -bz" to make the changes take effect. You
should also update your version to at least 5.67b since there is a
nasty security hole in 5.67a and earlier.
Another nice thing is that if you have mail.debug set and you run
syslogd, your incoming and outgoing mail messages will get logged.
See the /etc/syslog.conf file for details.
The sources for sendmail+IDA may be found at uxc.cso.uiuc.edu. They
require no patching to run under Linux.
If you're going to run sendmail+IDA, I strongly recommend you go to
the sendmail5.67b+IDA1.5 version since all required Linux-specific
patches are now in the vanilla sources and several security holes have
been plugged that WERE (!!!) in the older version you may have grabbed
or built before about December 1st, 1993.
The May/June 1994 edition of Linux Journal has an extensive article on
the care and feeding of sendmail+IDA. The coming edition of the Linux
DOC Project Networking Administration Guide will have an even more
detailed and complete version.
4.2.1. The sendmail.m4 file
Sendmail+IDA requires you to set up a sendmail.m4 file rather than
editing the sendmail.cffile directly. The nice thing about this is
that it is simple to set up mail configurations that are extremely
difficult (if not totally impossible for most people to set up
correctly) in smail or traditional sendmail.
The sendmail.m4 file that corresponds to the above smail example looks
like the following:
dnl #------------------ SAMPLE SENDMAIL.M4 FILE ------------------
dnl #
dnl # (the string 'dnl' is the m4 equivalent of commenting out a line)
dnl #
dnl # you generally don't want to override LIBDIR from the compiled in paths
dnl #define(LIBDIR,/usr/local/lib/mail)dnl # where all support files go
define(LOCAL_MAILER_DEF, mailers.linux)dnl # mailer for local delivery
define(POSTMASTERBOUNCE)dnl # postmaster gets bounces
define(PSEUDODOMAINS, BITNET UUCP)dnl # don't try DNS on these
dnl #
dnl #-------------------------------------------------------------
dnl #
dnl # names we're known by
define(PSEUDONYMS, myhostname.subdomain.domain myhostname.UUCP)
dnl #
dnl # our primary name
define(HOSTNAME, myhostname.subdomain.domain)
dnl #
dnl # our uucp name
define(UUCPNAME, myhostname)dnl
dnl #
dnl #-------------------------------------------------------------
dnl #
define(UUCPNODES, |uuname|sort|uniq)dnl # our uucp neighbors
define(BANGIMPLIESUUCP)dnl # make certain that uucp
define(BANGONLYUUCP)dnl # mail is treated correctly
define(RELAY_HOST, my_uucp_neighbor)dnl # our smart relay host
define(RELAY_MAILER, UUCP-A)dnl # we reach moria via uucp
dnl #
dnl #--------------------------------------------------------------------
dnl #
dnl # the various dbm lookup tables
dnl #
define(ALIASES, LIBDIR/aliases)dnl # system aliases
define(DOMAINTABLE, LIBDIR/domaintable)dnl # domainize hosts
define(PATHTABLE, LIBDIR/pathtable)dnl # paths database
define(GENERICFROM, LIBDIR/generics)dnl # generic from addresses
define(MAILERTABLE, LIBDIR/mailertable)dnl # mailers per host or domain
define(UUCPXTABLE, LIBDIR/uucpxtable)dnl # paths to hosts we feed
define(UUCPRELAYS, LIBDIR/uucprelays)dnl # short-circuit paths
dnl #
dnl #--------------------------------------------------------------------
dnl #
dnl # include the 'real' code that makes it all work
dnl # (provided with the source code)
dnl #
include(Sendmail.mc)dnl # REQUIRED ENTRY !!!
dnl #
dnl #------------ END OF SAMPLE SENDMAIL.M4 FILE -------
4.2.2. Defining a local mailer
Unlike most Unix distributions, Linux does not come with a local mail
delivery agent by default. I recommend using the commonly available
deliver program, which is an optional package in a number of the usual
Linux distributions. In order to do so, you need to define a
LOCAL_MAILER_DEF in the sendmail.m4 file that points to a file that
looks like:
# -- /usr/local/lib/mail/mailers.linux --
# (local mailers for use on Linux )
Mlocal, P=/usr/bin/deliver, F=SlsmFDMP, S=10, R=25/10, A=deliver $u
Mprog, P=/bin/sh, F=lsDFMeuP, S=10, R=10, A=sh -c $u
There is a also built-in default for deliver in the Sendmail.mc file
that gets included into the sendmail.cf file. To specify it, you
would not use the mailers.linux file but would instead define the
following in your sendmail.m4 file:
dnl --- (in sendmail.m4) ---
define(LOCAL_MAILER_DEF, DELIVER)dnl # mailer for local delivery
Unfortunately, Sendmail.mc assumes deliver is installed in /bin, which
is not the case with Slackware1.1.1 (which installs it in /usr/bin).
In that case you'd need to either fake it with a link or rebuild
deliver from sources so that it resides in /bin.
4.2.3. The Sendmail+IDA dbm Tables
Setting up special behavior for sites or domains is done through a
number of optional dbm tables rather than editing the sendmail.cf file
directly. Refer to the July-1994 issue of Linux Journal, to the docs
in the sources, or to the sendmail chapter in the newest version of
the Linux DOC Project Networking Administration Guide which will be
available real-soon-now for more details.
o mailertable - defines special behavior for remote hosts or
domains.
o uucpxtable - forces UUCP delivery of mail to hosts that are in
DNS format.
o pathtable - defines UUCP bang-paths to remote hosts or domains.
o uucprelays - short-circuits the pathalias path to well-known
remote hosts.
o genericfrom - converts internal addresses into generic ones
visible to the outside world.
o xaliases - converts generic addresses to/from valid internal
ones.
o decnetxtable - converts RFC-822 addresses to DECnet-style
addresses.
4.2.4. So Which Entries are Really Required?
When not using any of the optional dbm tables, sendmail+IDA delivers
mail via the DEFAULT_MAILER (and possibly RELAY_HOST and RELAY_MAILER)
defined in the sendmail.m4 file used to generate sendmail.cf. It is
easily possible to override this behavior through entries in the
domaintable or uucpxtable.
A generic site that is on Internet and speaks Domain Name Service, or
one that is UUCP-only and forwards all mail via UUCP through a smart
RELAY_HOST, probably does not need any specific table entries at all.
Virtually all systems should set the DEFAULT_HOST and PSEUDONYMS
macros, which define the canonical site name and aliases it is known
by, and DEFAULT_MAILER. If all you have is a relay host and relay
mailer, you don't need to set these defaults since it works
automagically.
UUCP hosts will probably also need to set UUCPNAME to their official
UUCP name. They will also probably set RELAY_MAILER, and RELAY_HOST
which enable smart-host routing through a mail relay. The mail
transport to be used is defined in RELAY_MAILER and should usually be
UUCP-A for UUCP sites.
If your site is SMTP-only and talks `Domain Name Service', you would
change the DEFAULT_MAILER to TCP-A and probably delete the
RELAY_MAILER and RELAY_HOST lines.
4.3. Sendmail 8.6
Sendmail 8.6.x from Berkeley is the latest major revision after
sendmail5. It has wonderful built-in support for building under
Linux. Just "make linux" and you'll be all set.
4.4. Other "transport agents"
The following also are known to run under Linux. Consult "archie" for
details regarding how to find them...
o smail2.5 - very simple UUCP-based smail
4.5. Local Delivery Agents
Unlike most operating systems, Linux does not have mail "built-in".
You'll need a program to deliver the local mail. One good program is
Rich Braun's "lmail" program, but I've switched to using the more
commonly available "deliver" program.
Documentation for how to use either for local delivery is in the
sendmail5.67b+IDA1.5 binary release (on sunsite) mentioned above.
5. Mail "User Agents"
This section contains information related to "user agents", which
means the software the user sees and uses. This software relies on
the "transport agents" mentioned above.
5.1. Elm
Elm compiles, installs, and runs flawlessly under Linux up to and
through Slackware 1.1.1 (gcc2.4.5, gcclib 4.4.4). For more
information, see the elm sources and installation instructions.
The only thing to know is that Elm's Configure script incorrectly sets
the "ranlib" variable in config.sh. The Elm Development Team has been
informed of this little problem, so please don't bother them with it
(again).
o (from Chip Rosenthal - chip@chinacat.unicom.com ) The easiest way
to deal with this is to create a file called config.over at the top
of you Elm source tree and include the line:
ranlib='ranlib'
o Alternatively, you can just remember to correctly edit the line in
config.sh when Configure gives you the chance to do so.
o Elm and filter need to be mode 2755 (group mail) with
/usr/spool/mail mode 775 and group mail.
If you use a binary distribution, you'll need to create a
/usr/local/lib/elm/elm.rc file to override the compiled-in hostname
and domain information:
o replace "subdomain.domain" with your domain name replace
o "myhostname" with you un-domainized hostname replace
o "my_uucp_neighbor" with the uucp name of your upstream site
#---------- /usr/local/lib/elm/elm.rc ------------------
#
# this is the unqualified hostname
hostname = myhostname
#
# this is the local domain
hostdomain = subdomain.domain
#
# this is the fully qualified hostname
hostfullname = myhostname.subdomain.domain
#
#--------------------------------------------------------
One thing you want to be aware of is that if you have Elm compiled to
be MIME-able, you need metamail installed and in your path or Elm will
not be able to read MIME mail you've received. Metamail is available
on thumper.bellcore.com and of course via "archie".
We have heard reports that gcc and gcclib newer than v2.4.5 and v4.4.4
respectively are rather strict and fail to compile Elm. Here's the
scoop as reported by ccnp@unitrix.utr.ac.za (Neil Parker) who
forwarded a posting by longyear@netcom.com (Al Longyear).
o ELM is using internal fields in the FILE structure in an effort to
bypass the standards. (The _flag, _IOERR, and _IOEOF are old fields
for the pre-POSIX runtime package. While POSIX doesn't say that you
can't define these fields, it does not say that you _must_. Linux
does not. It does say that programs should not be written to use
them, even if they are in the implementation.)
where it does if (fp->_flag & _IOERR) ...
change it to if (ferror(fp)) ....
where it does if (fp->_flag & _IOEOF) ...
change it to if (feof(fp)) ...
These are the ANSI/POSIX definitions for the same function.
o While this item is not Linux-specific, it's a nagging bug
nevertheless. We've heard that Elm sometimes fails with a message
that it's unable to malloc() some massive number of bytes. This
has been identified as an Elm Bug. The identified workaround is to
remove the post-processed global mail aliases (aliases.dir and
aliases.pag).
o (from scot@catzen.gun.de (Scot W. Stevenson) )
The current metamail package requires csh for some of its scripts.
Failure to have csh (or tcsh) will cause most interesting errors...
5.2. Mailx
There is a fine binary implementation of mailx located on the various
Linux archive sites. Make sure you grab version 5.3b or later since
there are security problems in v5.3a. If you're into building from
sources, mailx v5.5 compiles without patching under Linux if you have
"pmake" installed.
The only potential problem I'm aware of with the binary distribution
on sunsite is that it seems to be compiled in a way that requires
/usr/lib/smail rather than /usr/lib/sendmail as a transport agent.
You probably need a link if you run sendmail on your system.
If anybody is still using it, I strongly recommend removing the old
"edmail" stuff from SLS1.00 and replacing it with mailx.
5.3. Other user agents
The following also are known to run under Linux. Consult "archie" for
details regarding how to find them...
o Pine - from the Univ. of Washington
o Metamail - allows MIME support
o mh - yet another way to handle mail
o deliver - file/process mail based on rules
o procmail - file/process mail based on rules
o Majordomo - manages e-mail lists
o Mserv - provide files-by-mail
6. Acknowledgements
The following people have helped in the assembly of the information
(and experience) that helped make this document possible:
Steve Robbins, Ian Kluft, Rich Braun, Ian Jackson, Syd Weinstein, Ralf
Sauther, Martin White, Matt Welsh, Ralph Sims, Phil Hughes, Chip
Rosenthal, Scot Stevenson, Neil Parker
If I forgot anybody, my apologies...